//
//  NetworkManager.h
//  BaseDemo
//
//  Created by coder on 2019/6/24.
//  Copyright © 2019 coder. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef BOOL(^ResposeHandleBlock)(NSString * _Nullable code, NSString * _Nullable message);

NS_ASSUME_NONNULL_BEGIN

@interface NetworkManager : NSObject

+ (id)shareManager;
/**
 设置get请求的path，需要在app初始化时设置
 */
- (void)setGetRequestsPaths:(NSArray <NSString *>*)getPaths;
/**
 判断是否是个get请求
 */
- (BOOL)isGetRequest:(NSString *)url;
/**
 注册responseHandle
 */
- (void)registerResponse:(ResposeHandleBlock)responseBlock;
/**
 收到回报后，处理业务前调用

 @param code 回包的code
 @param message 回包的message
 @return YES：继续走流程；NO：终止流程
 */
- (BOOL)handleCode:(NSString *)code message:(NSString *)message;

/**
 检测网络环境
 */
- (void)monitorNetworking;

- (BOOL)haveNetwork;
- (BOOL)isWiFi;

@end

NS_ASSUME_NONNULL_END
